package com.cscec5b.inspection.dto;

import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import java.util.List;

public class ProjectSyncDtos {

    public static class ProjectItem {
        @NotBlank @Size(max=64)  public String project_inner_number;  // 项目编码（业务唯一键）
        @NotBlank @Size(max=128) public String project_name;          // 项目名称
        @NotNull @Valid          public List<@NotBlank String> members;     // 成员编号列表
        @NotNull @Valid          public List<@NotBlank String> subprojects; // 单位工程名称列表
        @NotBlank @Pattern(regexp="0|1") public String is_update;           // "0"新建，"1"更新（实际按 UPSERT 处理）
    }

    public static class ProjectSyncRequest {
        @NotNull @Size(min=1) @Valid public List<ProjectItem> data;
    }

    public static class Detail {
        public String project_inner_number;
        public boolean is_success;
        public String error;
        public Detail(String n, boolean ok, String err) {
            this.project_inner_number = n; this.is_success = ok; this.error = err;
        }
    }

    public static class ProjectSyncResponse {
        public String code = "200";
        public String msg = "请求成功";
        public List<Detail> detail;
        public ProjectSyncResponse(List<Detail> d) { this.detail = d; }
    }
}
